# 编译器与选项
CXX = g++
CXXFLAGS = -std=c++17 -Wall -Wextra -pthread -g -Icommon -Iserver

# 源文件列表
SERVER_SRC := \
    server/server_main.cpp \
    server/server_core.cpp \
    common/thread_pool.cpp \
    common/user_manager.cpp \
    common/room_manager.cpp \
    common/utils.cpp

CLIENT_SRC := \
    client/client.cpp

# 目标文件名
TARGET_SERVER = server_chat
TARGET_CLIENT = client_chat

# 默认目标
all: $(TARGET_SERVER) $(TARGET_CLIENT)

# 编译服务端
$(TARGET_SERVER): $(SERVER_SRC)
	$(CXX) $(CXXFLAGS) -o $@ $^

# 编译客户端
$(TARGET_CLIENT): $(CLIENT_SRC)
	$(CXX) $(CXXFLAGS) -o $@ $^

# 清理目标
clean:
	rm -f $(TARGET_SERVER) $(TARGET_CLIENT)

.PHONY: all clean

